<template>
  <div>
    <!-- 面包屑导航 -->
    <v-bread></v-bread>

    <!-- 表格 -->
    <el-table :data="memberList" border style="width: 100%">
      <el-table-column prop="uid" label="用户编号" width="180">
      </el-table-column>
      <el-table-column prop="nickname" label="昵称" width="180">
      </el-table-column>
      <el-table-column prop="phone" label="手机号" width="180">
      </el-table-column>
      <el-table-column prop="status" label="状态">
        <template slot-scope="item">
          <div>
            <el-tag effect="dark" type="success" v-if="item.row.status == 1">
              启用
            </el-tag>
            <el-tag effect="dark" type="warning" v-else> 禁用 </el-tag>
          </div>
        </template>
      </el-table-column>
      <el-table-column label="操作">
        <template slot-scope="item">
          <div>
            <el-button
              size="mini"
              type="primary"
              icon="el-icon-edit"
              @click="edit(item.row.uid)"
            ></el-button>
            <!-- <el-button
              size="mini"
              type="primary"
              icon="el-icon-delete"
              @click="del(item.row.id)"
            ></el-button> -->
          </div>
        </template>
      </el-table-column>
    </el-table>
    <!-- 弹窗 -->
    <v-dialog
      :menberInfo="menberInfo"
      @cancel="cancel"
      ref="diaInfo"
    ></v-dialog>
  </div>
</template>

<script>
import vDialog from "./dialog.vue";
import { mapGetters, mapActions } from "vuex";
export default {
  data() {
    return {
      menberInfo: {
        isShow: false,
      },
    };
  },
  mounted() {
    this.getMemberAction();
  },
  components: {
    vDialog,
  },
  methods: {
    ...mapActions({
      getMemberAction: "member/getMemberAction",
    }),
    // 关闭弹窗
    cancel(e) {
      console.log(e);
      this.menberInfo.isShow = e;
    },
    // 编辑
    edit(uid) {
      // console.log(uid);
      this.menberInfo = {
        isShow: true,
      };
      // 调用子的事件
      this.$refs.diaInfo.lookup(uid);
    },
    // // 删除
    // del(id) {},
  },
  computed: {
    ...mapGetters({
      memberList: "member/getMember",
    }),
  },
};
</script>
<style lang=less scoped >
.el-table {
  margin-top: 25px;
}
</style>
